// 审核详情
<template>
  <div class="examineDetail">
    <el-breadcrumb separator="/" class="bread-title">
      <el-breadcrumb-item :to="{ path: '/projectList' }">跟投项目管理</el-breadcrumb-item>
      <el-breadcrumb-item :to="{path: '/transferManagement'}">跟投转让管理</el-breadcrumb-item>
      <el-breadcrumb-item>详情</el-breadcrumb-item>
    </el-breadcrumb><div class="part">
      <div class="title">转让人信息</div>
      <div class="content">
        <p>
          <span>转让人姓名：</span>
          <span>{{assignor.staffName}}</span>
        </p>
        <p>
          <span>工号：</span>
          <span>{{assignor.staffCode}}</span>
        </p>
        <p>
          <span>业务线：</span>
          <span>{{assignor.businessLineName}}</span>
        </p>
        <p>
          <span>部门：</span>
          <span>{{assignor.departmentName}}</span>
        </p>
        <p>
          <span>职位：</span>
          <span>{{assignor.stationName}}</span>
        </p>
      </div>
    </div>
    <div class="part">
      <div class="title">受让人信息</div>
      <div class="content">
        <p>
          <span>受让人姓名：</span>
          <span>{{assignee.staffName}}</span>
        </p>
        <p>
          <span>工号：</span>
          <span>{{assignee.staffCode}}</span>
        </p>
        <p>
          <span>业务线：</span>
          <span>{{assignee.businessLineName}}</span>
        </p>
        <p>
          <span>部门：</span>
          <span>{{assignee.departmentName}}</span>
        </p>
        <p>
          <span>职位：</span>
          <span>{{assignee.stationName}}</span>
        </p>
      </div>
    </div>
    <div class="part">
      <div class="title">转让信息</div>
      <div class="content">
        <p>
          <span>项目名称：</span>
          <span>{{detailInfo.projectName}}</span>
        </p>
        <p>
          <span>跟投金额：</span>
          <span>￥{{detailInfo.investMoney | numFormat}}</span>
        </p>
        <p>
          <span>跟投份额：</span>
          <span>{{detailInfo.investNum}}份</span>
        </p>
      </div>
      <div class="content">
        <p>
          <span>确认状态：</span>
          <span v-show="detailInfo.confirmationStatus == 0">待确认</span>
          <span v-show="detailInfo.confirmationStatus == 1">已确认</span>
          <span v-show="detailInfo.confirmationStatus == 2">驳回</span>
        </p>
        <p v-show="detailInfo.confirmationStatus != 2">
          <span>确认时间：</span>
          <span>{{detailInfo.confirmationTime}}</span>
        </p>
        <p></p>
      </div>
      <div class="agreement" v-show="detailInfo.confirmationStatus != 2">
        <div class="zhuanrang">
          <span>转让类型：</span>
          <span v-show="detailInfo.transferType == 0">投资转让</span>
          <span v-show="detailInfo.transferType == 1">离职转让</span>
          <span v-show="detailInfo.transferType == 9">其他</span>
        </div>
        <div class="agreement-one">转让协议：</div>
        <template>
          <el-table
            :data="filsInfo"
            border
            style="width: 100%">
            <el-table-column
              fixed
              align=center
              label="序号"
              type="index"
              width="80">
            </el-table-column>
            <el-table-column
              align=center
              prop="fileName"
              label="文件名"
              width="180">
            </el-table-column>
            <el-table-column
              align=center
              prop="fileUploadName"
              label="上传附件名"
              width="180">
            </el-table-column>
            <el-table-column
              align=center
              prop="createName"
              label="创建人"
              width="120">
            </el-table-column>
            <el-table-column
              align=center
              prop="createTime"
              label="上传时间"
              width="180">
            </el-table-column>
            <el-table-column
              align=center
              fixed="right"
              label="操作">
              <template slot-scope="scope">
                <el-button type="text" size="small"><a v-bind:href="scope.row.fileAddress" target="_blank">下载</a></el-button>
                <el-button @click="handlePdf(scope.row)" type="text" size="small" :disabled="suffix == 'pdf' ? false:true">PDF预览</el-button>
              </template>
            </el-table-column>
          </el-table>
        </template>
        <div class="yes-no" v-show="detailInfo.auditStatus != 0">
          <span>是否线下已经退款给对方：</span>
          <span>{{detailInfo.offlineRefundFlag?'是':'否'}}</span>
        </div>
      </div>
      <div class="agreement">
        <div class="agreement-one">记录</div>
        <template>
          <el-table
            :data="recodeData"
            border
            style="width: 100%">
            <el-table-column
              fixed
              align=center
              label="序号"
              type="index"
              width="80">
            </el-table-column>
            <el-table-column
              align=center
              prop="operationInfo"
              label="操作">
            </el-table-column>
            <el-table-column
              align=center
              prop="operationUsername"
              label="操作人">
            </el-table-column>
            <el-table-column
              align=center
              prop="roleName"
              label="角色">
            </el-table-column>
            <el-table-column
              align=center
              prop="createDate"
              label="时间">
            </el-table-column>
            <el-table-column
              align=center
              prop="remark"
              label="备注">
            </el-table-column>
          </el-table>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
import api from '@/api/apiPath'
export default {
  name:'examineDetail',
  data(){
    return {
      tableData:[],
      assignee:{},
      detailInfo:{},
      assignor:{},
      filsInfo:[],
      suffix:'',
      recodeData:[],
    }
  },
  filters:{
    numFormat(val ){
      val += ''
      let x = val.split('.');
      let x1 = x[0] 
      let x2 = x.length > 1 ? '.' + x[1] : ''
      var rgx = /(\d+)(\d{3})/  
      while (rgx.test(x1)) {  
      x1 = x1.replace(rgx, '$1' + ',' + '$2')
      }
      return x1 + x2
    }
  },
  created(){
    this.getInfo()
  },
  methods:{
    handlePdf(row){
      window.open(row.fileAddress)
    },
    getInfo(){
      this.id = this.$route.query.id
      console.log(this.$route.query.id)
      this.axios.get(api.selectTransferDetail+ '/'+this.id).then((res)=>{
        console.log(res.data)
        if(res.data.data.assignor){
          this.assignor = res.data.data.assignor
        }
        if(res.data.data.assignee){
          this.assignee = res.data.data.assignee
        }
        this.detailInfo = res.data.data
        this.filsInfo = res.data.data.files
        if(this.filsInfo.length){
          this.suffix = this.filsInfo[0].fileAddress.substr(this.filsInfo[0].fileAddress.lastIndexOf('.')+1) 
        }
        this.recodeData = res.data.data.operationLogs
      })
    }
  }
}
</script>

<style lang='stylus'>
.examineDetail{
  .bread-title{
    height:30px;
    font-size:16px;
  }
  height :100%;
  .title{
    font-size :18px;
    font-weight :700;
  }
  .part{
    margin-bottom :30px;
  }
  .content{
    display :flex;
    p{
      margin :0;
      padding:0;
      margin-top:20px;
      flex:1;
      font-size :15px;
    }
  }
  .zhaunrang-type{
    font-size :15px;
    margin-top :30px;
  }
  .agreement{
    margin-top :30px;
    .agreement-one{
      font-size :15px;
      margin-bottom :10px;
    }
  }
  .yes-no{
    margin-top :30px;
    font-size :15px;
  }
  a{
    text-decoration: none;
    color: #409EFF;
  }
  .zhuanrang{
    font-size :15px;
    margin-bottom :20px;
  }
}
</style>
